//package com.ttdevs.ttrss.parse;
//
//import java.io.IOException;
//import java.io.InputStream;
//
//import org.xmlpull.v1.XmlPullParser;
//import org.xmlpull.v1.XmlPullParserException;
//import org.xmlpull.v1.XmlPullParserFactory;
//
//import com.ttdevs.ttrss.bean.Source;
//import com.ttdevs.ttrss.net.URLConn;
//import com.ttdevs.ttrss.util.TtLog;
//
//public class PullParserSource {
//	private final static String CHANNEL = "channel";// channel
//	private final static String ITEM = "item";// item
//	private final static String TITLE = "title";// ����
//	private final static String LINK = "link";// l��
//	private final static String DESCRIPTION = "description";// ����
//	private final static String LASTBUILDDATE = "lastBuildDate";// ����
//	private final static String PUBDATE = "pubDate";// ����
//
//	private String tagName;
//
//	public Source parse(String urlStr) throws XmlPullParserException,
//			IOException {
//		TtLog.d("��ʼ������...");
//		InputStream is = new URLConn().getResult(urlStr);
//		Source source = null;
//
//		XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
//		XmlPullParser parser = factory.newPullParser();
//
//		// XmlPullParser parser = Xml.newPullParser(); //
//		// ��android.util.Xml����һ��XmlPullParserʵ��
//		parser.setInput(is, "UTF-8"); // ���������� ��ָ����뷽ʽ
//
//		int eventType = parser.getEventType();
//		while (eventType != XmlPullParser.END_DOCUMENT) {
//			tagName = parser.getName();
//			switch (eventType) {
//			case XmlPullParser.START_DOCUMENT:// ��ʼһ���ĵ�������articlesList
//				source = new Source();
//				break;
//			case XmlPullParser.START_TAG:
//				if (tagName.equals(TITLE)) {
//					source.setTitle(parser.nextText());
//				} else if (tagName.equals(LINK)) {
//					source.setLink(parser.nextText());
//				} else if (tagName.equals(DESCRIPTION)) {
//					source.setDescription(new String(parser.nextText()
//							.getBytes(), "utf-8"));
//				} else if (tagName.equals(LASTBUILDDATE)) {
//					source.setLastBuildDate(parser.nextText());
//				} else if (tagName.equals(PUBDATE)) {
//					source.setPubDate(parser.nextText());
//				} else if (tagName.equals(ITEM)) {
//					return source;
//				}
//				eventType = parser.next();
//				break;
//			case XmlPullParser.END_TAG:
//
//				break;
//			}
//			eventType = parser.next();
//		}
//		return source;
//	}
//}
